IF OBJECT_ID('dbo.vwInfoEdDeliverables') IS NOT NULL
BEGIN
    DROP VIEW dbo.vwInfoEdDeliverables
    IF OBJECT_ID('dbo.vwInfoEdDeliverables') IS NOT NULL
        PRINT '<<< FAILED DROPPING VIEW dbo.vwInfoEdDeliverables >>>'
    ELSE
        PRINT '<<< DROPPED VIEW dbo.vwInfoEdDeliverables >>>'
END
go
-- =======================================================================
-- Object Name: (VIEW) dbo.vwInfoEdDeliverables
--
-- Author:      Kevin Cashman, Parallax Consulting LLC
--
-- Create date: 7/13/2007 
--
-- Description: View to Deliverable Statuses
--
-- Used BY Procedure/Report: (MOST)
--
--------------------------------------------------------------------------
-- Date        Initials  Modification
--------------------------------------------------------------------------
-- 7/13/07     KC        Created
-- 9/12/07     KC        Added 'PARTNERS', changed join on REPORTTYPE
--                            to OUTER JOIN
--
-- =======================================================================
CREATE VIEW dbo.vwInfoEdDeliverables
AS
      
SELECT    DISTINCT D.Inst_Code,
          D.prop_no,
          D.ReportID,
          D.ReportName,
          C1.code_desc AS REPORTCAT,
          D.REPORTCAT AS REPORTCAT_CODE,
          C2.code_desc AS REPORTTYPE,
          D.DueDate,
          D.Completed,
          D.CompletedDate,
          C3.code_desc AS REPORTSTAT,
          S.REPORTSTAT AS REPORTSTAT_CODE,
          S.StatusDate,
          S.Comments,
          D.DeliverableID
FROM      dbo.InfoEdPTDeliverable D LEFT OUTER JOIN dbo.InfoEdCodetab C1 ON D.REPORTCAT = C1.codeID
               LEFT OUTER JOIN dbo.InfoEdCodetab C2 ON D.REPORTTYPE = C2.codeID
               LEFT OUTER JOIN dbo.InfoEdPTDeliverableStatus S ON D.DeliverableID = S.DeliverableID
               LEFT OUTER JOIN dbo.InfoEdCodetab C3 ON S.REPORTSTAT = C3.codeID
WHERE     D.Inst_Code = 'PARTNERS'
     
go
IF OBJECT_ID('dbo.vwInfoEdDeliverables') IS NOT NULL
    PRINT '<<< CREATED VIEW dbo.vwInfoEdDeliverables >>>'
ELSE
    PRINT '<<< FAILED CREATING VIEW dbo.vwInfoEdDeliverables >>>'
go
